﻿
using CommonType;
using MediatR;
using S_Gridding.Domains.FoundGridding;
using S_Gridding.Infrastructure.Interface.IRead;
using S_Gridding.Read.Api.Application.Commands;
using S_Userinfor.Domains;

namespace S_Gridding.Read.Api.Application.CommandsHanders
{
    public class TeamigridUpdCommandsHanders : IRequestHandler<TeamigridUpdCommands, Teamgrid>
    {
        private readonly IDTeamgRepository _dTeamg;

        public TeamigridUpdCommandsHanders(IDTeamgRepository dTeamg)
        {
            _dTeamg = dTeamg;
        }

        public async Task<Teamgrid> Handle(TeamigridUpdCommands request, CancellationToken cancellationToken)
        {
            string sql = "SELECT * FROM Teamgrid WHERE Id = @Id";
            return await _dTeamg.GetOne(request.Id, sql);
        }
    }
}
